package org.csmzxy.class2333;

public class 选择排序 {
    public static void main(String[] args){
        int[] arr = {2,5,7,9,43,8};
        for (int i = 0 ; i<arr.length-1;i++){
            int key = i;
            for (int j = i+1;j<arr.length;j++){
                if(arr[key]>arr[j]){
                    key = j;
                }
            }
            int temp = arr[i];
            arr[i]=arr[key];
            arr[key]=temp;
        }for (int i = 0 ; i < arr.length; i++){
            System.out.print(arr[i] +" " );
        }
    }
}
